package game.entity.mob;

import java.util.LinkedList;

import common.Area;
import common.Log;
import common.Rectangle;
import common.Vector;

import game.entity.EntityType_E;
import game.entity.Entity_A;
import game.physics.CollisionSolution;
import game.physics.MapCollision;
import game.physics.SimulationBody;

public abstract class Mob_Entity extends Entity_A {
	public Mob_Entity(String name) {
		super(name, EntityType_E.MOB);
		Body = new SimulationBody();
	}
	public final SimulationBody Body;
	
	public void collide(MapCollision collision, int time) {
		
		CollisionSolution solution = collision.solve(Body);
		if(solution != null) {
			Body.Location.translate(solution.Displacement);
			if(solution.Left | solution.Right) {
				Body.Velocity.X = -Body.Velocity.X;
				return;
			}
			if(solution.Above | solution.Below) {
				Body.Velocity.Y = -Body.Velocity.Y;
			}
		}
	}
}
